#!/bin/bash
# SLURM submission script for GPU correctness validation
# Usage: sbatch run-validation-slurm.sh

echo "Submitting GPU correctness validation job to SLURM..."

# Check if SLURM is available
if ! command -v sbatch >/dev/null 2>&1; then
    echo "❌ SLURM not available. Use manual script: ./run-validation-manual.sh"
    exit 1
fi

# Submit the job
JOB_ID=$(sbatch run-validation.slurm 2>&1 | grep -o '[0-9]\+')

if [ -n "$JOB_ID" ]; then
    echo "✅ Job submitted successfully!"
    echo "   Job ID: $JOB_ID"
    echo "   Queue: kshdnormal"
    echo "   GPU: 1 DCU"
    echo "   Time limit: 10 minutes"
    echo
    echo "Monitor progress with:"
    echo "   squeue -j $JOB_ID"
    echo "   scontrol show job $JOB_ID"
    echo "   tail -f logs/runlog/validation_${JOB_ID}.out"
else
    echo "❌ Failed to submit job"
    exit 1
fi